package com.cskaoyan.controller.wx;

import com.cskaoyan.model.admin.vo.BaseRespVo;
import com.cskaoyan.model.vx.vo.WxSearchIndexVo;
import com.cskaoyan.service.wx.WxSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * @author hanshuai
 * @version 1.0
 * @description @TODO
 * @date 2021/12/2 19:16
 */
@RestController
@RequestMapping("/wx/search")
public class WxSearchController {
    @Autowired
    WxSearchService wxSearchService;

    @RequestMapping("/index")
    public BaseRespVo indexShow(HttpSession httpSession) {
        WxSearchIndexVo wxSearchIndexVo = wxSearchService.indexShow(httpSession);
        return BaseRespVo.ok(wxSearchIndexVo);
    }

    @RequestMapping("/helper")
    public BaseRespVo searchHelper(String keyword) {
        List<String> word = wxSearchService.searchHelp(keyword);
        return BaseRespVo.ok(word);
    }

    @RequestMapping("/clearhistory")
    public BaseRespVo searchClearHistory(HttpSession httpSession){
        wxSearchService.searchClearHistory(httpSession);
        return BaseRespVo.ok(null);
    }
}
